package com.joinlabs.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;

import com.joinlabs.entity.Log;
import com.joinlabs.service.ILogService;

@Controller
@RequestMapping("/ArticlePage")
@SessionAttributes(names= {"logByid","logList"})
public class ArticleAction {
	@Resource
	private ILogService logService;// 日志
	@RequestMapping("/showArticle")
	public ModelAndView showArticle(ModelMap map,String logId) {
	    System.out.println("**********************"+logId);
		 Log logByid=logService.selectLogByid(Long.parseLong(logId));
	     map.addAttribute("logByid",logByid);
		//System.out.println("**********************"+logByid);
	  // 查询所有日志
		List<Log> logList = logService.selectAllLog();
		map.addAttribute("logList", logList); 
		 
		return new ModelAndView("/articlePage/article");
	}
}
